export const ACTION = {
  CREATE: 'create',
  READ: 'read',
  UPDATE: 'update',
  DELETE: 'delete',
  BATCH_DELETE: 'batchDelete',
  LIST: 'list',
} as const;

export const ACTION_DESCRIPTION = {
  [ACTION.CREATE]: '创建',
  [ACTION.READ]: '读取',
  [ACTION.UPDATE]: '更新',
  [ACTION.DELETE]: '删除',
  [ACTION.BATCH_DELETE]: '批量删除',
  [ACTION.LIST]: '查看列表',
};

export const RESOURCE = {
  USER: 'user',
  ROLE: 'role',
} as const;

export const RESOURCE_DESCRIPTION = {
  [RESOURCE.USER]: '用户',
  [RESOURCE.ROLE]: '角色',
};

export const P = {
  USER_CREATE: `${RESOURCE.USER}:${ACTION.CREATE}`,
  USER_READ: `${RESOURCE.USER}:${ACTION.READ}`,
  USER_UPDATE: `${RESOURCE.USER}:${ACTION.UPDATE}`,
  USER_DELETE: `${RESOURCE.USER}:${ACTION.DELETE}`,
  USER_BATCH_DELETE: `${RESOURCE.USER}:${ACTION.BATCH_DELETE}`,
  USER_LIST: `${RESOURCE.USER}:${ACTION.LIST}`,

  ROLE_CREATE: `${RESOURCE.ROLE}:${ACTION.CREATE}`,
  ROLE_READ: `${RESOURCE.ROLE}:${ACTION.READ}`,
  ROLE_UPDATE: `${RESOURCE.ROLE}:${ACTION.UPDATE}`,
  ROLE_DELETE: `${RESOURCE.ROLE}:${ACTION.DELETE}`,
  ROLE_BATCH_DELETE: `${RESOURCE.ROLE}:${ACTION.BATCH_DELETE}`,
} as const;

export type PermissionCode = (typeof P)[keyof typeof P];
